<include file="Common:header" />
<body>
<!--面包屑导航 开始-->
<div class="crumb_warp">
    <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
    <i class="fa fa-home"></i> <a href="{:U(MODULE_NAME.'/Index/info')}">首页</a> &raquo; 添加产品模型
</div>
<!--面包屑导航 结束-->

<!--结果集标题与导航组件 开始-->
<div class="result_wrap">
    <div class="result_title">
        <h3>快捷操作</h3>
        <notempty name='Think.get.msg'>
            <div class="mark">
                <p>{$Think.get.msg}</p>
            </div>
        </notempty>
    </div>
    <div class="result_content">
        <div class="short_wrap">
            <a href="{:U(MODULE_NAME.'/FieldProduct/add')}"><i class="fa fa-plus"></i>添加产品模型</a>
            <a href="{:U(MODULE_NAME.'/FieldProduct/index')}"><i class="fa fa-refresh"></i>全部产品模型</a>
        </div>
    </div>
</div>
<!--结果集标题与导航组件 结束-->

<div class="result_wrap">
    <form action="{:U(MODULE_NAME.'/FieldProduct/add')}" method="post">
        <table class="add_tab">
            <tbody>
            <tr>
                <th width="10%"><i class="require">*</i>字段标题：</th>
                <td>
                    <input type="text" name="field_title" id="field_title">
                    <span><i class="fa fa-exclamation-circle yellow"></i>字段标题必须填写!</span>
                </td>
            </tr>
            <tr>
                <th><i class="require">*</i>字段名称：</th>
                <td>
                    <input type="text" name="field_name" id="field_name">
                    <span><i class="fa fa-exclamation-circle yellow"></i>（格式如：field_name，name）</span>
                </td>
            </tr>


            <tr>
                <th>字段类型：</th>
                <td>
                    int <input type="radio" name="field_type" value="1" checked>&nbsp;&nbsp;
                    varchar <input type="radio" name="field_type" value="2">&nbsp;&nbsp;
                    text <input type="radio" name="field_type" value="3">&nbsp;&nbsp;
                </td>
            </tr>
            <tr>
                <th>input类型：</th>
                <td>
                    text <input type="radio" name="field_input_type" value="1" checked  onclick="getField()">&nbsp;&nbsp;
                    radio <input type="radio" name="field_input_type" value="2"  onclick="getField()">&nbsp;&nbsp;
                    checkbox <input type="radio" name="field_input_type" value="3"  onclick="getField()">&nbsp;&nbsp;
                    textarea <input type="radio" name="field_input_type" value="4"  onclick="getField()">&nbsp;&nbsp;
                </td>
            </tr>
            <tr id="field_radio_value">
                <th>类型值：</th>
                <td>
                    <input type="text" name="field_radio_value" value="1|开启,0|关闭" >
                    <span><i class="fa fa-exclamation-circle yellow"></i>类型值只有在radio的情况下才需要配置，格式:1|开启,0|关闭</span>
                </td>
            </tr>

            <tr id="field_checkbox_value">
                <th>类型值：</th>
                <td>
                    <input type="text" name="field_checkbox_value" value="1|黑色,2|红色,3|蓝色" >
                    <span><i class="fa fa-exclamation-circle yellow"></i>类型值只有在checkbox的情况下才需要配置，格式:1|黑色,2|红色,3|蓝色</span>
                </td>
            </tr>


            <tr>
                <th>字段注释：</th>
                <td>
                    <input type="text" name="field_notes" id="field_notes">
                </td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <input type="submit" id="button" value="提交">
                    <input type="button" class="back" onclick="history.go(-1)" value="返回">
                </td>
            </tr>

            </tbody>
        </table>
        <div class="tips" style="margin-top: 15px;">
            <h3>产品模型添加注意事项：</h3>
            <p>1、由网站开发人员在网站开发初期进行配置</p>
        </div>
    </form>
</div>
</body>
</html>
<script type="text/javascript">

    getField();
    function getField(){
        var filed = $('input[name=field_input_type]:checked').val(); //获取 点击radio 的值
        if(filed == '2'){
            $('#field_radio_value').show();
        }else{
            $('#field_radio_value').hide();
        }

        if(filed == '3'){
            $('#field_checkbox_value').show();
        }else{
            $('#field_checkbox_value').hide();
        }
    }


    $(function() {
        $("#button").click(function() {
            var field_title = $("#field_title").val();
            var field_name = $("#field_name").val();
            if(field_title == 0){
                layer.msg('请添加字段标题！');
                $("#field_title").focus();
                return false;
            }
            if(field_name == ''){
                layer.msg('请添加字段名称！');
                $("#field_name").focus();
                return false;
            }
        });
    })
</script>